package com.springsecurity.advice;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import com.springsecurity.common.enums.ExceptionEnums;
import com.springsecurity.common.exception.LgException;
import com.springsecurity.common.vo.ExceptionResult;



@ControllerAdvice
public class CommonExceptionHandler {
	@ExceptionHandler(LgException.class)
	public ResponseEntity<ExceptionResult> handlerException(LgException e){
		ExceptionEnums em = e.getExceptionEnums();
		return ResponseEntity.status(em.getCode()).body(new ExceptionResult(em));
	}
}
